#include "PrecompiledHeader.h"
#include "Particle.h"

/*--------------------------------------------------------------------------*/

Particle::Particle(float lifetime) :
	m_lifetime(lifetime)
{
	this->m_position = glm::vec3();
	this->m_direction = glm::vec3(0.0f, 1.0f, 0.0f);
}

/*--------------------------------------------------------------------------*/

Particle::~Particle()
{

}

/*--------------------------------------------------------------------------*/

const glm::vec3& Particle::GetPosition() const
{
	return this->m_position;
}

/*--------------------------------------------------------------------------*/

void Particle::SetPosition(const glm::vec3& newpos)
{
	this->m_position = newpos;
}

/*--------------------------------------------------------------------------*/

const glm::vec3& Particle::GetDirection() const
{
	return this->m_direction;
}

/*--------------------------------------------------------------------------*/

void Particle::SetDirection(const glm::vec3& newdir)
{
	this->m_direction = newdir;
}

/*--------------------------------------------------------------------------*/

bool Particle::Calculate(float step)
{
	this->m_position = this->m_position + this->m_direction * step;

	this->m_lifetime -= step;

	return this->m_lifetime > 0.0f;
}

/*--------------------------------------------------------------------------*/

void Particle::SetLifetime(const float& lifetime)
{
	this->m_lifetime = lifetime;
}

/*--------------------------------------------------------------------------*/

const float& Particle::GetLifetime() const
{
	return this->m_lifetime;
}

/*--------------------------------------------------------------------------*/
